﻿@model UserProfileModel
@{
    ViewBag.Title = @Model.User.FullName;
}

<div class="title">@Html.GravatarImage(Model.User.Email, Model.User.FullName) @Model.User.FullName</div>
<table class="grid">
    <tr>
        <th>@Strings.Title
        </th>
        <th>@Strings.Post_Description
        </th>
        <th>@Strings.Post_PublishDate
        </th>
        <th>@Strings.Post_LastModified
        </th>
        <th>
            Average Score
        </th>
    </tr>
    @foreach (var item in Model.Posts) {     
    <tr>
        <td>
            @Html.RouteLink(item.Title, "ViewPost", new { slug = item.Slug })
        </td>
        <td>
            @item.Description
        </td>
        <td>
            @Html.DisplayFor(x => item.PublishDate)
        </td>
        <td>
            @Html.DisplayFor(x => item.LastModified)
        </td>
        <td>
            @( item.PostRatings.Any() ? String.Format("{0:f2}", item.PostRatings.Average( x => x.Rating )) : "-" )
        </td>
    </tr>    
    }
</table>
